import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        double result = 0.0;
        while(true) {
            Scanner in = new Scanner(System.in);
            System.out.println("Please choose your calculation method:(+/-/*/÷)");
            if(in.hasNextLine()) {
                String method = in.nextLine();
                System.out.println("Please input the first number(a):");
                int num_1 = in.nextInt();
                System.out.println("Please input the second number(b):");
                int num_2 = in.nextInt();
                switch (method) {
                    case "+" : result = Main.add(num_1, num_2);break;
                    case "-" : result = Main.substract(num_1, num_2);break;
                    case "*" : result = Main.multiply(num_1, num_2);break;
                    case "/" : result = Main.divide(num_1, num_2);break;
                    default:
                        System.out.println("Please input the legal method!");
                }
                System.out.println("The result is " + result);
            }else{
                System.out.println("Please input your method!");
            }
        }
    }

    public static int add(int a,int b){
        return a+b;
    }

    public static int substract(int a,int b){
        return a-b;
    }

    public static int multiply(int a,int b){
        return a*b;
    }

    public static double divide(double a,double b){
        return a/b;
    }
}
